export const name = 'sdp_workspace'
export const module = 'sdp_workspace'
export const title = '工作区'

import { ref } from 'vue'
export function init(self) {
  const obj = {
    name,
    module,
    title,
    columns: [
      {
        prop: 'id',
        label: '编号',
        hide: true,
      },
      {
        prop: 'name',
        label: '名称',
        sort_by_gbk: true,
        order: 'asc',
      },
      {
        prop: 'db_host',
        label: 'db_host',
      },
      {
        prop: 'db_port',
        label: 'db_port',
      },
      {
        prop: 'db_database',
        label: 'db_database',
      },
      {
        prop: 'db_username',
        label: 'db_username',
      },
      {
        prop: 'db_jdbcurl',
        label: 'db_jdbcurl',
      },
      {
        prop: 'db_classname',
        label: 'db_classname',
      },
      {
        prop: 'remark',
        label: '备注',
        sort_by_gbk: true,
      },
    ],
    editColumns: [
      {
        prop: 'id',
        label: '编号',
        disabled: true,
        hide: true,
      },
      {
        prop: 'name',
        label: '名称',
      },
      {
        prop: 'db_host',
        label: 'db_host',
      },
      {
        prop: 'db_port',
        label: 'db_port',
      },
      {
        prop: 'db_database',
        label: 'db_database',
      },
      {
        prop: 'db_username',
        label: 'db_username',
      },
      {
        prop: 'db_password',
        label: 'db_password',
      },
      {
        prop: 'db_jdbcurl',
        label: 'db_jdbcurl',
      },
      {
        prop: 'db_classname',
        label: 'db_classname',
      },
      {
        prop: 'remark',
        label: '备注',
      },
    ],

    queryColumns: [
    ],

    remoteConfig: {
      count: {module, method: 'count'},
      list: {module, method: 'list'},
      export_excel: {module, method: 'export_excel'},
      edit: {module, method: 'update', keys: [
        'id',
      ]},
      add: {module, method:'add'},
      delete: {module, method: 'delete', keys: [
        'id',
      ]},
    }
  }
  for(let p in obj) {
    self[p] = ref(obj[p])
  }
}
